
             
/**
 * 
 *
 * @File name:  AddTFixedAssetsDetailAction.java   添加【资产详细信息:T_FIXED_ASSETS_DETAIL】
 * @Create on:  2011-11-01 08:49:421
 * @Author   :  许福辉
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */
           
        
package com.boho.estates.usual.action;

            
import java.sql.Connection;

import cn.boho.framework.actions.ActionImp;
import cn.boho.framework.context.ActionContext;
import cn.boho.framework.exception.UserOperationException;
import cn.boho.framework.fileserver.UploadFilePO;
import cn.boho.framework.po.DynaBeanMap;
import cn.boho.framework.service.MessageService;

import com.boho.estates.usual.service.UsualService;

public class UpdateTFixedAssetsDetailAction extends ActionImp {
	private Connection con=null;
	private UploadFilePO f1 = null;
	@Override
	protected void doException(ActionContext atx, Exception ex) {
		if (!(ex instanceof UserOperationException)) {
			atx.setErrorContext("BOHO_COMMON_1001", MessageService.getMessage("BOHO_COMMON_1001"),"【资产详细信息】", ex);
		}
		if (f1 != null && !f1.getFileName().equals("")) {
			f1.deleteLocal();
		}
	}
	@Override
	protected int performExecute(ActionContext atx) throws Exception {
		String picname = "";
		String is_delete=atx.getStringValue("IS_DELETE");
		try{
			f1 = atx.getUploadFilePO("PIC");
		}catch(Exception e){};
		if(f1!=null && !f1.getFileName().equals("")){
			f1.write(atx,false);//由配置文件决定是用FTP，还是存在本地
			picname = f1.getDatePath()+"/"+f1.getFullFileIdName();
		}
		if("1".equals(is_delete)){
			UsualService.deleteTFixedAssetsDetail(con, atx);
		}else{
			UsualService.updateTFixedAssetsDetail(con, atx,picname);
		}
		
		return 1;
	}
	@Override
	protected int verifyParameters(ActionContext atx) throws Exception {
		con = atx.getConection();
		return 1;
	}
}
